
//-------------------------
// Legislators as Lobbyists
// TABLE A10
//-------------------------

clear
use masterdata_senate.dta

gen sencom = .
replace sencom = 1 if primary_committee == "Health, Education, Labor, and Pensions"
replace sencom = 0 if sencom == . & house == 0

gen sencom2 = .
replace sencom2 = 1 if committee1 == "Health, Education, Labor, and Pensions"
replace sencom2 = 1 if committee2 == "Health, Education, Labor, and Pensions"
replace sencom2 = 1 if committee3 == "Health, Education, Labor, and Pensions"
replace sencom2 = 1 if committee4 == "Health, Education, Labor, and Pensions"
replace sencom2 = 0 if sencom2 == . & house == 0

gen sentradecom =.
replace sentradecom = 1 if committee1 == "Finance"
replace sentradecom = 1 if committee2 == "Finance"
replace sentradecom = 1 if committee3 == "Finance"
replace sentradecom = 1 if committee4 == "Finance"
replace sentradecom = 0 if sentradecom == . & house == 0


// generate demographic variables

gen senior = (pop65to74 + pop75to84 + popover85)/population
gen whiteratio = white/population
gen blackratio = black/population
gen a1 = white/population
gen a2 = black/population
gen a3 = native/population 
gen a4 = asian/population
gen a5 = pacific/population
gen a6 = otherrace/population 
gen a7 = twomorerace/population
gen ethnic = 1 - (a1^2 + a2^2 + a3^2 + a4^2 + a5^2 + a6^2 + a7^2)
gen nohs = lessthanhs/pop_over25
gen hs = highschool/pop_over25 
gen loweredu = nohs + hs
gen college = bachelor/pop_over25
gen advanced = (master + professional + doctoral)/pop_over25
gen unemployment = pop_unemployed/pop_civilian

replace committee_chair = 0 if committee_chair ==.
replace medianincome = ln(medianincome+1)
replace pubunionmember = pubunionmember/100

macro define member_char "leadership sencom trade_idealpoint1 finance_trade_subcom approp_labor_subcom emply_wrk_safe_subcom"
macro define district_char "whiteratio loweredu gini medianincome unemployment state_presdem2008 change_china_exp l_manu_emp pubunionmember"

// regression

eststo clear
eststo: quietly reg contact $member_char $district_char, vce(cluster icpsr) 
eststo: quietly reg contact $member_char $district_char i.congress, vce(cluster icpsr) 
eststo: quietly reg contactt $member_char $district_char, vce(cluster icpsr) 
eststo: quietly reg contactt $member_char $district_char i.congress, vce(cluster icpsr) 
esttab, star(** 0.05 *** 0.01) ar2
